<template>
  <div class="comment">
    <el-avatar class="avatar" :src="info.avatar" :size="50"></el-avatar>
    <div class="right-con">
      <div class="comment-title">
        <a class="comment-author">
          <span>{{ info.nickname }}</span>
          <el-tag v-if="uid == info.uid" effect="plain" size="mini">作者</el-tag>
          <span v-if="info.rootCommentId!=0&&info.toCommentId!==0&&info.toCommentId!=info.rootCommentId">回复</span>
          <span v-if="info.rootCommentId!=0&&info.toCommentId!==0&&info.toCommentId!=info.rootCommentId"> {{ info.toCommentNickname }}</span>
        </a>
        <div class="comment-data">
          <span class="date">{{ info.createTime | dateFormat3 }}</span>
        </div>
      </div>
      <div class="comment-content">
        {{ info.content }}
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ['info', 'uid'],
  data() {
    return {
    }
  },
}
</script>

<style scoped lang="less">
.comment {
  border-top: 1px solid #eee;
  padding-top: 20px;
  padding-bottom: 10px;
  display: flex;
  align-items: flex-start;
  font-size: 12px;

  .avatar {
    margin-right: 15px;
    margin-top: 5px;
    flex-shrink: 0;
  }

  .right-con {
    flex-grow: 1;
  }

  .comment-title {
    color: black;
    display: flex;

    .comment-author {
      font-weight: bold;
      font-size: 13px;

      span {
        margin-right: 8px;
      }
    }

    .comment-data {
      color: rgba(0, 0, 0, .5);
    }
  }

  .reply {
    color: rgba(0, 0, 0, .5);
  }

  .reply:hover {
    color: rgba(0, 0, 0, 1);
    cursor: pointer;
  }

  .comment-content {
    font-size: 14px;
    letter-spacing: 2px;
    font-family: "微软雅黑", Arial, sans-serif;
  }
}
</style>
